package com.springboot.service.impl;

import com.springboot.mapper.OrderFormMapper;
import com.springboot.mapper.UserLoginFormMapper;
import com.springboot.model.OrderForm;
import com.springboot.model.UserLoginForm;
import com.springboot.service.DoctorViewPatientListDetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

/**
 * 医生在患者列表界面查看该患者的几次预约详情
 */
@Service
public class DoctorViewPatientListDetailsServiceImpl implements DoctorViewPatientListDetailsService {
    @Autowired
    private UserLoginFormMapper userLoginFormMapper;

    @Autowired
    private OrderFormMapper orderFormMapper;

    //通过手机号查找用户
    @Override
    public UserLoginForm findUserByTel(String tel)
    {
        UserLoginForm user=userLoginFormMapper.selectByTel(tel);
        return user;
    }

    //通过医生id和患者id查找预约记录
    @Override
    public ArrayList<OrderForm> findOrderByDoubleId(OrderForm orderForm)
    {
        ArrayList<OrderForm> orderForms=orderFormMapper.selectByDoubleId(orderForm);
        return orderForms;
    }

    //通过用户id查找用户
    @Override
    public UserLoginForm findUserById(Integer userId)
    {
        UserLoginForm userLoginForm=userLoginFormMapper.selectByPrimaryKey(userId);
        return userLoginForm;
    }

    //通过预约id查找预约记录
    @Override
    public OrderForm findOrderByBookId(Integer bookId)
    {
        OrderForm orderForm=orderFormMapper.selectByPrimaryKey(bookId);
        return orderForm;
    }
}
